<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <#macro greet name color="red">
        <h2 style="color:${color}">Hello ${name}!</h2>
    </#macro>
    <#--嵌套内容-->
    <#macro do_thrice>
        <#nested 1>
        <#nested 2>
        <#nested 3>
    </#macro>

    <#macro repeat count>
        <#list 1..count as x>
            <#nested x,x/2,x==count>
        </#list>
    </#macro>

    <p>
        <@greet name="Jim"/>
    </p>
    <p>
        <@greet name="Lucy" color="blue"/>
    </p>
    <p>
        <@do_thrice ; x>
            ${x} hello world!
        </@do_thrice>
    </p>
    <p>
        <@repeat count=4;c,halfc,last>
            ${c}. ${halfc} <#if last>Last!</#if><br>
        </@repeat>
    </p>
</body>
</html>